Skip to content

fix: configure CORS via env ALLOWED_ORIGINS#581

Merged
Xhristin3 merged 1 commit into
Gatheraa:mainfrom
Xuccessor:fix/issue-519-cors-allowlist
Jun 28, 2026
Merged

fix: configure CORS via env ALLOWED_ORIGINS#581
Xhristin3 merged 1 commit into
Gatheraa:mainfrom
Xuccessor:fix/issue-519-cors-allowlist

Conversation

@Xuccessor

Copy link
Copy Markdown
Contributor

Summary

No CORS was configured in main.ts, allowing any origin to connect. This fix adds an env-driven CORS allowlist (ALLOWED_ORIGINS) so only explicitly listed origins are permitted in production.

Changes

  • app/backend/src/main.ts: enable CORS with origin allowlist from process.env.ALLOWED_ORIGINS (comma-separated). Credentials are only passed when the origin is in the allowlist. Methods limited to GET/POST/PUT/PATCH/DELETE/OPTIONS.
  • app/backend/.env.example: document ALLOWED_ORIGINS with a sensible local default.

Testing

  • ALLOWED_ORIGINS=http://localhost:3000Origin: http://localhost:3000 preflight returns Access-Control-Allow-Origin.
  • Unlisted origin → no Access-Control-Allow-Origin header returned.

Closes #519

@Xhristin3 Xhristin3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Xhristin3 Xhristin3 merged commit b898d70 into Gatheraa:main Jun 28, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[backend][security] CORS allowlist is commented out

2 participants